import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import axios from 'axios'
import VueAxios from "vue-axios";
import cookie from 'vue-cookie';
import Video from 'video.js';
import 'video.js/dist/video-js.css';
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.prototype.$video = Video;
axios.defaults.baseURL = '/api';
axios.defaults.timeout = 8000;
// 接口错误拦截
axios.interceptors.response.use( response=>{
  let res = response.data;
  if(res.status ===0){
    return res.data;
  }else if(res.status ===10){
    window.location.href = '/#/login';
    return  Promise.reject(res);
  }else {
    alert(res.msg)
    return  Promise.reject(res);
  }
},error => {
  let res = error.response;
  alert(res.dagger.message);
  return Promise.reject(error)
});
Vue.config.productionTip = false
Vue.use(VueAxios,axios)
Vue.use(cookie)
Vue.use(ElementUI)
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
